{template header}
<div class="console-title">
    <a href="{U:('c=product&a=publish')}" class="button float-right">添加产品</a>
    <h2>
        <a>企业管理</a>
        <span>></span>
        <a>产品管理</a>
    </h2>
</div>
<div class="list-div">
    <form method="post" id="listForm" autocomplete="off">
        <input type="hidden" name="formsubmit" value="yes">
        <input type="hidden" name="formhash" value="{FORMHASH}">
        <table cellpadding="0" cellspacing="0" border="0" width="100%" class="listtable">
            <thead>
            <tr>
                <th width="20"><input title="" type="checkbox" class="checkbox checkall checkmark"></th>
                <th width="80">图片</th>
                <th>产品名称</th>
                <th>价格</th>
                <th width="140">上架时间</th>
                <th width="80" class="align-center">操作</th>
            </tr>
            </thead>
            <tbody>
            {loop $productList $product}
            <tr id="row_{$product[product_id]}">
                <td><input title="" type="checkbox" class="checkbox checkmark itemCheckBox" name="products[]" value="{$product[product_id]}"></td>
                <td><div class="bg-cover asyncload" data-original="{img $product[thumb]}" style="width: 80px; height: 80px;"></div></td>
                <td>
                    <h3 style="font-size: 12px;">{$product[title]}</h3>
                    <p style="margin-top: 5px; color: #888; font-size: 11px;">{$product[subtitle]}</p>
                </td>
                <td>{$product[price]}</td>
                <td>{date:$product[create_time]|'Y-m-d H:i:s'}</td>
                <td class="align-center">
                    <a href="{U:('c=product&a=publish&product_id='.$product[product_id])}">编辑产品</a>
                </td>
            </tr>
            {/loop}
            </tbody>
            <tfoot>
            <tr>
                <td colspan="20" class="operations">
                    <div class="pagination float-right">{$pagination}</div>
                    <label><input type="checkbox" class="checkbox checkall checkmark"> 全选</label>
                    <label><button type="button" class="btn" data-action="delete">删除</button></label>
                </td>
            </tr>
            </tfoot>
        </table>
    </form>
</div>
<script type="text/javascript">
    $(function () {
        $("[data-action=delete]").on('click', function () {
            if ($(".itemCheckBox:checked").length === 0){
                DSXUI.error('请选择产品');
                return false;
            }
            DSXUI.showConfirm('删除产品', '确认要删除所选产品吗?', function () {
                $("#listForm").submit();
            });
        });
    });
</script>
{template footer}